@echo off
chcp 65001 >nul
echo ==========================================
echo 🚀 STM32项目多平台推送工具
echo ==========================================

echo.
echo 📋 检查Git状态...
git status --porcelain
if %errorlevel% neq 0 (
    echo ❌ Git状态检查失败！
    pause
    exit /b 1
)

echo.
echo 📝 当前分支信息：
git branch --show-current
git log --oneline -1

echo.
echo ==========================================
echo 🔄 开始推送到多个平台...
echo ==========================================

echo.
echo [1/2] 📤 正在推送到GitHub...
git push origin main
if %errorlevel% equ 0 (
    echo ✅ GitHub推送成功！
    echo 🔗 查看地址: https://github.com/Xiaohua2181/stm32_Button_and_Led
) else (
    echo ❌ GitHub推送失败！
    set /a error_count+=1
)

echo.
echo [2/2] 📤 正在推送到Gitee...
git push gitee main
if %errorlevel% equ 0 (
    echo ✅ Gitee推送成功！
    echo 🔗 查看地址: https://gitee.com/lu-joke/stm32_Button_and_Led
) else (
    echo ❌ Gitee推送失败！请确保已在Gitee创建仓库
    set /a error_count+=1
)

echo.
echo ==========================================
if %error_count% equ 0 (
    echo 🎉 所有平台推送完成！
) else (
    echo ⚠️  部分平台推送失败，请检查错误信息
)
echo ==========================================

echo.
echo 💡 提示：
echo - 如果Gitee推送失败，请先在 https://gitee.com 创建仓库
echo - 仓库名：stm32_Button_and_Led
echo - 设置为公开，不要初始化README
echo.
pause